import java.util.Scanner;
public class FamilyAccount {
  public static void main(String[] args) {
    boolean isFlag = true;
    String details = "";
    int account = 10000;
    Scanner scan = new Scanner(System.in);
    while (isFlag) {
      System.out.println(
        "\n-------------------家庭收支记账软件-------------------"
      );
      System.out.println("                   1 收支明细");
      System.out.println("                   2 登记收入");
      System.out.println("                   3 登记支出");
      System.out.println("                   4 退   出");
      System.out.print("                   请选择(1-4): ");
      int type = scan.nextInt();
      switch (type) {
        case 1:
          System.out.println(
            "\n-------------------当前收支记录-------------------"
          );
          System.out.println(
            "收支" +
            '\t' +
            "账户金额" +
            '\t' +
            "收支金额" +
            '\t' +
            "说    明" +
            '\n'
          );
          System.out.println(details);
          System.out.println(
            "-------------------------------------------------"
          );
          break;
        case 2:
          int income = 0;
          String incomeInfo = "无";
          // while (isExit != 'Y' && isExit != 'N') {
            System.out.println("请输入收入金额：");
            income = scan.nextInt();
            System.out.println("请输入收入说明：");
            incomeInfo = scan.next();
          // }
          details +=  
            "收入" +
            '\t' +
            (account += income) +
            '\t' + '\t' +
            income +
            '\t' + '\t' +
            incomeInfo +
            '\n';
          System.out.println(
            "\n-------------------登记收入完成-------------------"
          );
          break;
        case 3:
          int outcome = 0;
          String outcomeInfo = "无";
          // while (isExit != 'Y' && isExit != 'N') {
            System.out.println("请输入支出金额：");
            outcome = scan.nextInt();
            System.out.println("请输入支出说明：");
            outcomeInfo = scan.next();
          // }
          details +=  
            "收入" +
            '\t' +
            (account -= outcome) +
            '\t' + '\t' +
            outcome +
            '\t' + '\t' +
            outcomeInfo +
            '\n';
          System.out.println(
            "\n-------------------登记支出完成-------------------"
          );
          break;
        case 4:
          char isExit = 'a';
          while (isExit != 'Y' && isExit != 'N') {
            System.out.println("确认是否退出Y/N");
            isExit = scan.next().toUpperCase().charAt(0);
            System.out.println("isExit" + isExit);
          }
          break;
        default:
          System.out.println("请输入正确数字");
          break;
      }
    }
  }
}
